//
//  UIButton+Extension.h
//  GongDan
//
//  Created by 了凡 on 16/1/20.
//  Copyright © 2016年 河北广联. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSUInteger, CSButtonEdgeInsetsStyle) {
    CSButtonEdgeInsetsStyleTop,     // image在上，label在下
    CSButtonEdgeInsetsStyleLeft,    // image在左，label在右
    CSButtonEdgeInsetsStyleBottom,  // image在下，label在上
    CSButtonEdgeInsetsStyleRight    // image在右，label在左
};

@interface UIButton (Extension)

/**
 *   title button
 *
 */
+ (instancetype _Nullable )buttonWithType:(UIButtonType)buttonType
                                     font:(UIFont *_Nullable)font
                                    frame:(CGRect)frame
                                    title:(NSString *_Nullable)title
                               titleColor:(UIColor *_Nullable)color;

/**
 *   title 变色 button
 *
 */
+ (instancetype _Nullable )buttonWithType:(UIButtonType)buttonType
                                     font:(UIFont *_Nullable)font
                                    frame:(CGRect)frame
                                    title:(NSString *_Nullable)title
                              selectTitle:(NSString *_Nullable)sTitle
                               titleColor:(UIColor *_Nullable)color
                              selectColor:(UIColor *_Nullable)sColor;

/**
 *  Img 改变 button
 *
 */
+ (instancetype _Nullable)buttonWithType:(UIButtonType)buttonType
                         frame:(CGRect)frame
                         image:(NSString *_Nullable)imageStr
                     selectImg:(NSString *_Nullable)sImgStr;

/**
 *    Img + title button
 *
 */
+ (instancetype _Nullable)buttonWithType:(UIButtonType)buttonType
                          font:(UIFont *_Nullable)font
                         frame:(CGRect)frame
                         title:(nullable NSString *)title
                    titleColor:(nullable UIColor *)color
                         image:(nullable NSString *)imageStr;

/**一键设置按钮属性*/
+ (UIButton *_Nullable)buttonWithTextColor:(UIColor *_Nullable)textColor
                             font:(CGFloat)textFont
                   backgroudColor:(UIColor *_Nullable)backColor
                             text:(NSString *_Nullable)text
                           Target:(id _Nullable)target
                         Selector:(SEL _Nullable)selector;

/**一键设置按钮属性带图片*/
+ (UIButton *_Nullable)buttonWithTextColor:(UIColor *_Nullable)textColor
                                      font:(CGFloat)textFont
                            backgroudColor:(UIColor *_Nullable)backColor
                                     image:(UIImage *_Nullable)image
                               imageIsLeft:(BOOL)isLeft
                                      text:(NSString *_Nullable)text                                   Target:(id _Nullable)target
                                  Selector:(SEL _Nullable)selector;

/**倒计时按钮*/
- (void)startTime:(NSInteger )timeout
            title:(NSString *_Nullable)tittle
       waitTittle:(NSString *_Nullable)waitTittle;

- (void)layoutButtonWithEdgeInsetsStyle:(CSButtonEdgeInsetsStyle)style ImageTitleSpace:(CGFloat)space;

@end
